package com.rd.controller;

import com.rd.common.CommonResult;
import com.rd.common.constant.JwtConstant;
import com.rd.service.SysUserService;
import com.rd.util.JwtUtil;
import com.rd.util.ResultUtil;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/test")
@Slf4j
public class TestController{

    @Resource
    private SysUserService sysUserService;


    @GetMapping("/user/list")
    //你拥有管理员的角色,才能访问这个方法
    @PreAuthorize("hasRole('ROLE_admin')")
    public CommonResult m1(){
        log.info("---->TestController中m1方法");
        return sysUserService.userList();
    }

}
